package com.leyou.search.web;

import com.leyou.search.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/goods")
public class  IndexController {
    @Autowired
    private IndexService indexService;
    @GetMapping("/init")
    public ResponseEntity<String> initIndex(){
        //删库跑路，再补偿一个新库
        this.indexService.initIndexes();
        //导入数据
        this.indexService.loadData();
        return ResponseEntity.ok("索引库初始化完成");
    }
}
